package concurrent.thread_create;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * 只不过是使用了Callable的匿名内部类而已
 */
public class UseFutureTask {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> futureTask = new FutureTask<>(() -> {
            System.out.println("7......");
            return "zhuZi";
        });
        new Thread(futureTask).start();

        System.out.println(futureTask.get());
    }
}
